s1 = """
    PAIntFuncType paclac;
    PAIntFuncType paclauto;
    PAIntFuncType paclrecirc;
    PAIntFuncType paclmodefrstleft;
    PAIntFuncType paclmodefrstright;
    PAIntFuncType paclmodesec;
    PAIntFuncType paclmaxac;
    PAIntFuncType paclfanlevel;
    PAIntFuncType pacllefttemp;
    PAIntFuncType paclrighttemp;
    PAIntFuncType paclmaxdefrost;
    PAIntFuncType pawdcautofrontdefrost;
    PAIntFuncType pawdcautoreardefrost;
    PAIntFuncType paclfrontdefrost;
    PAIntFuncType paclreardefrost;
    PAIntFuncType paclsync;
    PAIntFuncType paclairctrloff;
    PAIntFuncType paclhvacrectr;
    PAIntFuncType paclseclefttemp;
    PAIntFuncType paclsecrighttemp;
    PAIntFuncType paclsecfanlevel;
    PAIntFuncType paclfrntdefrostpopup;
    PAIntFuncType paclreardefrostpopup;
    PAIntFuncType paclsecrowonoffswith;
    PAIntFuncType paclintelliclimapop;
    PAIntFuncType paclclmsmtambientpop;
    PAIntFuncType paclclmsmtclosecpop;
    PAIntFuncType paclclmsmtclopasspop;
    PAIntFuncType paclseclockclimasw;
    PAIntFuncType paclsecautosw;
    PAIntFuncType paclgclean;
    PAIntFuncType paclsecclimaautoswith;
    PAIntFuncType paclintelliclimaegysavepop;
    PAIntFuncType paclmodesecri;
    PAIntFuncType paclfanlevelri;
    PAIntFuncType paclsecfanlevelri;
    PAIntFuncType paclautori;
    PAIntFuncType paclsecautoswri;
    PAIntFuncType paclpasstempsync;
    PAIntFuncType paclclimsmartonoroff;
    PAIntFuncType pacldrvrctrlswt;
    PAIntFuncType paclpassctrlswt;
    PAIntFuncType paclintelligentlycleanin;
"""

s2 = """
    int32_t availability;
    int32_t data;
    int32_t format;
    int32_t status;
"""

t1 = s1.split(";\n")
formats1 = []
names1 = []
print(t1)
for i in t1:
    if i != "":
        tmp = i.replace("\n", "").replace("    ", "").split(" ")
        formats1.append(tmp[0])
        names1.append(tmp[1])
print(len(formats1), formats1)
print(len(names1), names1)

t2 = s2.split(";\n")
formats2 = []
names2 = []
print(t2)
for i in t2:
    if i != "":
        tmp = i.replace("\n", "").replace("    ", "").split(" ")
        formats2.append(tmp[0])
        names2.append(tmp[1])
print(len(formats2), formats2)
print(len(names2), names2)

for j in range(0, len(formats1)):
    if j == 0:
        print('        if (strcmp(p1, "{}") == 0)'.format(names1[j])+"{")
        for k in range(0, len(formats2)):
            if k == 0:
                print('            if (strcmp(p2, "{}") == 0)'.format(names2[k])+"{")
            else:
                print('            else if (strcmp(p2, "{}") == 0)'.format(names2[k])+"{")
            if formats2[k] in ["int16_t", "int32_t"]:
                    print("                notification.{}.{} = ({})(ntohl(values[i]));".format(names1[j], names2[k], formats2[k]))
            else:
                    print("                notification.{}.{} = ({})values[i];".format(names1[j], names2[k], formats2[k]))
            print("            }")

    else:
        print('        else if (strcmp(p1, "{}") == 0)'.format(names1[j])+"{")
        for k in range(0, len(formats2)):
            if k == 0:
                print('            if (strcmp(p2, "{}") == 0)'.format(names2[k])+"{")
            else:
                print('            else if (strcmp(p2, "{}") == 0)'.format(names2[k])+"{")
            if formats2[k] in ["int16_t", "int32_t"]:
                    print("                notification.{}.{} = ({})(ntohl(values[i]));".format(names1[j], names2[k], formats2[k]))
            else:
                    print("                notification.{}.{} = ({})values[i];".format(names1[j], names2[k], formats2[k]))
            print("            }")
    print("        }")